class User 
  attr_accessor :remember_me, :email, :password, :share
  
  # Form text box sizes for display in view
  PASSWORD_SIZE = 15
  EMAIL_SIZE = 15
  
  # validation rules
  #validates_presence_of :email, :password 
  #validates_format_of :email,
  #  :with => /^[A-Z0-9._%-]+@([A-Z0-9-]+\.)+[A-Z]{2,4}$/i,
  #  :message => "must be a valid email address"
  
  def initialize(email, password)
    @remember_me = true
    @email = email
    @password = password
    @share = nil
  end
  
  def login!(session)
    session[:user] = self
  end
  
  def User.loginAdobe(user)
    usr = User.new(user.email, user.password)
    share = Share.new(usr)
    user.share = share
    share.get_authorization_token
    if (share.auth_token != nil)
      share.start_session
      share.get_my_library
    end
    return user
  end
  
end
